﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace EmployeeTracker.Helper
{
    public static class QueryProvider
    {
        /// <summary>
        /// Country related Query
        /// </summary>
        /// <returns></returns>
        public static string MakeSQLQueryToFetchCountryList()
        {
            return "SELECT [Country_ID],[Country_Name],[Country_Nationality]  FROM [L_Country]";
        }

        public static string MakeSQLQueryToInsertCountryToDatabase(string country,string nationality,int eu,int migration)
        {
            StringBuilder stringBuilder = new StringBuilder();
            stringBuilder.Append("insert into l_country ");
            stringBuilder.Append("(Country_Name,Country_Nationality,Country_EU,Country_Migration)  Values(");
            stringBuilder.Append(" '" +country + "',");
            stringBuilder.Append(" '" + nationality + "',");
            stringBuilder.Append(eu + ",");
            stringBuilder.Append(migration + ")");
            return stringBuilder.ToString();
        }

        /// <summary>
        /// Industry related query
        /// </summary>
        /// <returns></returns>
        public static string MakeSQLQueryToFetchIndustryList()
        {
            return "SELECT [Industry_ID],[Industry_Name]  FROM [L_Industry]";
        }

        public static string MakeSQLQueryToInsertIdustryToDatabase(string industry)
        {
            StringBuilder stringBuilder = new StringBuilder();
            stringBuilder.Append("insert into l_industry ");
            stringBuilder.Append("(Industry_Name) Values(");
            stringBuilder.Append("'" + industry + "'");
            stringBuilder.Append(")");
            return stringBuilder.ToString();
        }

        internal static string MakeSQLQueryToEditIndustryToDatabase(string industry, int rowid)
        {
            StringBuilder stringBuilder = new StringBuilder();
            stringBuilder.Append("update l_industry set");
            stringBuilder.Append("Industry_Name = '" +industry+ "'");
            stringBuilder.Append("where Industry_ID = "+rowid);
            return stringBuilder.ToString();
        }

        internal static string MakeSQLQueryToDeleteIndustryFromDatabase(int rowid)
        {
            StringBuilder stringBuilder = new StringBuilder();
            stringBuilder.Append("delete  from l_industry where Industry_ID="+rowid);
            return stringBuilder.ToString();
        }
    }
}
